
function levalonels(ls){
    //ls原数组
    let obj = {} 
    ls.forEach(item => {
        obj[item._id] = item
    })
    let result = []
    ls.forEach(item => {
        if (!item["pid"]) {
            result.push(item)
        }else{
            if (item["pid"] && !obj[item["pid"]]["children"]) {
                obj[item["pid"]]["children"] = []
            }
            item["pid"] && obj[item["pid"]]["children"].push(item)
        }
    })
    return result
}